From: Stefan Monnier Date: Sat, 14 Mar 2009 01:51:34 +0000 (+0000) Subject: (undo): Don't loop when encountering empty undo records. X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1~1^2~421^2~1271 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=2dacf81fd91b1d2ddb92e36227b0260e89c12d0e;p=emacs.git (undo): Don't loop when encountering empty undo records. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index fde9509b188..d4693408be7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2009-03-14 Stefan Monnier + + * simple.el (undo): Don't loop when encountering empty undo records. + 2009-03-13 Tassilo Horn * doc-view.el (doc-view-mode-map): Bind RET to image-next-line. diff --git a/lisp/simple.el b/lisp/simple.el index 8ffe5912865..d758fc1f0a7 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -1682,9 +1682,13 @@ as an argument limits undo to changes within the current region." ;; In the ordinary case (not within a region), map the redo ;; record to the following undos. ;; I don't know how to do that in the undo-in-region case. - (puthash buffer-undo-list - (if undo-in-region t pending-undo-list) - undo-equiv-table) + (let ((list buffer-undo-list)) + ;; Strip any leading undo boundaries there might be, like we do + ;; above when checking. + (while (eq (car list) nil) + (setq list (cdr list))) + (puthash list (if undo-in-region t pending-undo-list) + undo-equiv-table)) ;; Don't specify a position in the undo record for the undo command. ;; Instead, undoing this should move point to where the change is. (let ((tail buffer-undo-list)